package com.htrq.service;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.htrq.dao.ICardzcDao;
import com.htrq.entity.ICKzcxx;
import com.htrq.entity.Page;
@Service
@Transactional(value="txManager2")
public class ICardzcService {
	
	@Resource
	private ICardzcDao zcDao;
	
	public List<ICKzcxx> getAllizc(ICKzcxx zc, Page page) throws ParseException {
		//TODO Auto-generated method stub
		List<Object[]> list=zcDao.getAllizc(zc,page);
		List<ICKzcxx> zcs=new ArrayList<ICKzcxx>();
		for(Object[] obj:list){
			ICKzcxx kzc=new ICKzcxx();
			kzc.setAutoId(obj[0].toString());
			kzc.setNodeName(obj[1].toString());
			kzc.setCardout(obj[2].toString());
			kzc.setCardin(obj[3].toString());
			kzc.setRouteId(obj[4].toString());
			kzc.setLockMoney(obj[5].toString());
			kzc.setUnLockDate(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").parse(obj[6].toString()));
			kzc.setReason(obj[7].toString());
			kzc.setUserName(obj[8].toString());
			zcs.add(kzc);
		}
		return zcs;
	}

	public Long getTotal(ICKzcxx zc) {
		//TODO Auto-generated method stub
		return zcDao.getTotal(zc);
	}

	public List<Object[]> exportbyForm(ICKzcxx zc) {
		//TODO Auto-generated method stub
		return zcDao.exportbyForm(zc);
	}
}
